package com.unknowpupil.design.memento;

/**
 * @Description: <p>
 * 源发器类
 * </p>
 * @Author: <a> w10g </a>
 * @CreateDate: Create in 2020/4/28 16:56
 * @Classname: Emp
 * @Version: 1.0
 */
public class Emp {

    private String ename;
    private int age;
    private double salary;

    public Emp(String ename, int age, double salary) {
        this.ename = ename;
        this.age = age;
        this.salary = salary;
    }

    /**
     *     备忘操作 并返回 备忘录对象。
     */

    public EmpMemento memento() {
        return new EmpMemento(this);
    }

    /**
     * 进行数据回复，恢复成指定对象的值
     */
    public void recovery(EmpMemento mmt){
        this.ename = mmt.getEname();
        this.age = mmt.getAge();
        this.salary = mmt.getSalary();
    }


    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

}
